<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>试卷列表-学生</title>
    <!-- 新 Bootstrap 核心 CSS 文件 -->
    {load href="/static/css/bootstrap.min.css" /}
    {load href="/static/css/mycss.css" /}
    {load href="/static/css/dfjs_public.css" /}

    {load href="/static/js/jquery.js" /}
    <!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
    {load href="/static/js/bootstrap.min.js" /}
    {load href="/static/js/jquery.dataTables.min.js" /}
    <script>
        function show_right(){
            if($('.frame_left').hasClass('col-xs-10')){
                $('.frame_left').removeClass('col-xs-10');
                $('.frame_left').addClass('col-xs-12');
                $('.frame_right').hide();
            }else{
                $('.frame_left').removeClass('col-xs-12');
                $('.frame_left').addClass('col-xs-10');
                $('.frame_right').show();
            }

            $('#search_top').toggle();
        }

        $(function(){
            $('#nav_top li').click(function(){
                $(this).siblings().removeClass('active');
                $(this).addClass('active');
            });
        })

        $(function(){
            $('.search_list dt').click(function(){
                $(this).next().toggle();
                $(this).children('span').toggleClass('sjb');
            });
        })
    </script>


</head>
<body>
<div class="container-fluid hh ww" >
    <div class="frame_left col-xs-12">
        <div class="row head">
            <div class="col-xs-12 ph10 hh">
                <h3 class="fl mh0">考试系统</h3>
                <ul class="nav nav-pills ml40 fl" role="tablist" id="nav_top">
                    <li role="presentation"  class="active"><a href="{:url('home/Paper/getList')}">试卷库</a></li>
                    <li role="presentation"><a href="{:url('home/Examresult/getList')}">答卷列表</a></li>
                </ul>
            </div>
        </div>
        <div class="row" >
            <div class="col-xs-12 pt20">
                <table class="table table-striped bb table-sort">
                    <thead>
                    <tr>
                        <th>编号</th>
                        <th>名称</th>
                        <th>题目统计</th>
                        <th>时间限制</th>
                        <th style="width:200px;">操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    {foreach name="clist" item="list" key="k"}
                        <tr class="colum{$list.id}">
                            <td>{$list.id}</td>
                            <td>{$list.title}</td>
                            <td>{$list['singlenum']+$list['mulnum']+$list['fillnum']+$list['shortnum']+$list['judgenum']+$list['idenum']}题/{$list.allscore}.0分</td>
                            <td>{$list.timelimit}</td>
                            <td>
                                {if condition="in_array($list['id'],$paperlist) === false"}

                                <a href="{:url('home/Paper/examing',['id'=>$list.id])}" class="btn btn-default" target="_blank">开始做题</a>
                                {else /}
                                <a href="{:url('home/Paper/examResult',['id'=>$list.id])}" class="btn btn-default" target="_blank">查看结果</a>
                                {/if}
                            </td>
                        </tr>
                    {/foreach}
                    </tbody>
                </table>
            </div>
            <script>

            </script>
        </div>
    </div>

</div>
</body>
<script>
    $(function () {
        $('.table-sort').dataTable({
            "aaSorting": [[1, "asc"]], //默认第几个排序
            "bStateSave": true, //状态保存
            "paging": true,//是否开启本地分页
            "searching": false,//是否开启本地搜索
            "ordering":  false,//关闭排序
            "aoColumnDefs": [
                {"orderable": false, "aTargets": [0]}// 制定列不参与排序
            ]
        });
    });
    function publish(id){
//        alert(id);
        $.ajax({
            url:"{:url('admin/Paper/publish')}",
            data:{id:id},
            dataType:"json",
            type:"POST",
            success: function(d){
//                var d= JSON.parse(d);
//                console.log(d);
//                console.log(d.code)
//                return false;
                if(d.code == 1){
                    alert('发布成功');
                    //这个隐藏有问题
                    $(".publish"+id).hide();
                    $(".delPaper"+id).hide();
                }else{
                    alert('发布失败');
                }
            }
        });
    }
    function delPaper(id){
        $.ajax({
            url:"{:url('admin/Paper/delPaper')}",
            data:{id:id},
            dataType:"json",
            type:"POST",
            success: function(d){
//                var d= JSON.parse(d);
//                console.log(d);
//                console.log(d.code)
//                return false;
                if(d.code == 1){
                    alert('删除成功');
                    //这个隐藏有问题
                    $(".colum"+id).hide();
                }else{
                    alert('删除失败');
                }
            }
        });
    }
</script>
</html>